package com;

import com.sun.tools.sjavac.server.RequestHandler;
import jdk.javadoc.doclet.Doclet;
import jdk.javadoc.doclet.DocletEnvironment;
import jdk.javadoc.doclet.Reporter;
import jdk.jshell.SourceCodeAnalysis;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import javax.lang.model.SourceVersion;
import java.util.Locale;
import java.util.Set;

@Configurable
@EnableOpenApi
public class SwaggerConfig implements WebMvcConfigurer{

    @Bean
    public Docket applicationApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
                .select()
                .build()
                .apis(RequestHandlerSelectors.basePackage("com.controller"))
                .build()
                .apiInfo(myapiInfo());
    }

    private ApiInfo myapiInfo(){
        return new ApiInfoBuilder().title("数据接口对接的标题进行描述")
                .contact(new Contact("","",""))
                .version("1.0")
                .description("数据接口测试")
                .build();
    }
}
